from django.db import models
from utils.models import BaseModel,CoreModel
from mysystem.models import Users
# Create your models here.

class Meida(CoreModel):
    sn = models.CharField(max_length=100, null=True,verbose_name='媒体编号')
    address = models.CharField(max_length=100, null=True, verbose_name='媒体地址')
    house_name= models.CharField(max_length=100, null=True, verbose_name='楼盘名')
    house_type=models.CharField(max_length=100, null=True, verbose_name='楼盘性质')
    house_face= models.CharField(max_length=100, null=True, verbose_name='门的方位')
    house_near= models.CharField(max_length=100, null=True, verbose_name='朝向')
    house_size= models.CharField(max_length=100, null=True, verbose_name='尺寸')
    house_man= models.CharField(max_length=100, null=True, verbose_name='居住规模')
    house_price= models.CharField(max_length=100, null=True, verbose_name='居住规模')
    house_build= models.CharField(max_length=100, null=True, verbose_name='入住时间')
    house_exits= models.CharField(max_length=100, null=True, verbose_name='入住时间')
    house_lng= models.CharField(max_length=100, null=True, verbose_name='经度')
    house_lat= models.CharField(max_length=100, null=True, verbose_name='纬度')
    media_nums= models.CharField(max_length=100, null=True, verbose_name='媒体数量')
    media_type= models.CharField(max_length=100, null=True, verbose_name='媒体形式')
    media_disable= models.CharField(max_length=100, null=True, verbose_name='投放禁忌行')
    sort = models.PositiveSmallIntegerField(default=0, verbose_name="排序", help_text="显示顺序")
    status = models.IntegerField(default=0,verbose_name="状态")
    class Meta:
        db_table = 'tb_media'
        verbose_name = '媒体'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
    
    def save(self, *args, **kwargs):
        super(Meida, self).save(*args, **kwargs)


#消息表
class Customer(CoreModel):
    sn= models.CharField(max_length=100, null=True,verbose_name='媒体编号')
    sort= models.PositiveSmallIntegerField(default=0, verbose_name='排序')
    house_name= models.CharField(max_length=100, null=True, verbose_name='楼盘名')
    house_type= models.CharField(max_length=100, null=True, verbose_name='建筑类型')
    address= models.CharField(max_length=100, null=True, verbose_name='建筑地址')
    level= models.CharField(max_length=100, null=True, verbose_name='等级')
    house_man= models.CharField(max_length=100, null=True, verbose_name='居住规模')
    house_lng= models.CharField(max_length=100, null=True, verbose_name='经度')
    house_lat= models.CharField(max_length=100, null=True, verbose_name='纬度')
    status = models.IntegerField(default=0,verbose_name="状态")
    
    class Meta:
        db_table = 'tb_customer'
        verbose_name = '客户点位'
        verbose_name_plural = verbose_name

    def __str__(self):
        return f"{self.name}"
    
    def save(self, *args, **kwargs):
        super(Customer, self).save(*args, **kwargs)

#消息表
class Store(CoreModel):
    name= models.CharField(max_length=100, verbose_name='媒体名')
    sn= models.CharField(max_length=100, verbose_name='媒体编号')
    address= models.CharField(max_length=100, null=True, verbose_name='社区地址')
    store_name= models.CharField(max_length=100, null=True, verbose_name='门店名称')
    store_type= models.CharField(max_length=100, null=True, verbose_name='门店类型')
    store_house= models.CharField(max_length=100, null=True, verbose_name='社区')
    house_lng= models.CharField(max_length=100, null=True, verbose_name='经度')
    house_lat= models.CharField(max_length=100, null=True, verbose_name='纬度')
    man_nums= models.CharField(max_length=100, null=True, verbose_name='住户数量/办公室数量')
    distant= models.CharField(max_length=100, null=True, verbose_name='离门店距离')
    media_apply= models.CharField(max_length=100, null=True, verbose_name='门禁VD')
    media_created= models.CharField(max_length=100, null=True, verbose_name='投放时间')
    media_num1= models.CharField(max_length=100, null=True, verbose_name='出入口数量')
    media_num2= models.CharField(max_length=100, null=True, verbose_name='社区门禁锁点数量')

    class Meta:
        db_table = 'tb_store'
        verbose_name = '门店'
        verbose_name_plural = verbose_name

    def __str__(self):
        return f"{self.name}"
    
    def save(self, *args, **kwargs):
        super(Store, self).save(*args, **kwargs)